package cn.heyige.backend.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "AI解读响应")
public class AiInterpretResponse {
    
    @Schema(description = "解读ID", example = "ai_1704097200123")
    private String interpretationId;
    
    @Schema(description = "AI模型", example = "WENXIN")
    private String aiModel;
    
    @Schema(description = "解读等级", example = "PROFESSIONAL")
    private String interpretationLevel;
    
    @Schema(description = "生成时间")
    private LocalDateTime generatedAt;
    
    @Schema(description = "解读内容")
    private InterpretationContent interpretation;
    
    @Schema(description = "置信度", example = "0.85")
    private Double confidence;
    
    @Schema(description = "信息来源")
    private List<String> sources;
    
    @Schema(description = "是否使用缓存", example = "false")
    private Boolean cached;
    
    @Schema(description = "使用情况")
    private UsageInfo usage;
    
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "解读内容")
    public static class InterpretationContent {
        @Schema(description = "总结")
        private String summary;
        
        @Schema(description = "详细解读")
        private DetailedInterpretation detailed;
        
        @Schema(description = "建议")
        private List<String> suggestions;
        
        @Schema(description = "警告")
        private List<String> warnings;
        
        @Schema(description = "时间线")
        private Map<String, String> timeline;
        
        @Schema(description = "幸运元素")
        private LuckyElements luckyElements;
        
        @Data
        @Builder
        @AllArgsConstructor
        @NoArgsConstructor
        @Schema(description = "详细解读")
        public static class DetailedInterpretation {
            @Schema(description = "总体解读")
            private String general;
            
            @Schema(description = "事业解读")
            private String career;
            
            @Schema(description = "财运解读")
            private String finance;
            
            @Schema(description = "健康解读")
            private String health;
            
            @Schema(description = "感情解读")
            private String relationship;
        }
        
        @Data
        @Builder
        @AllArgsConstructor
        @NoArgsConstructor
        @Schema(description = "幸运元素")
        public static class LuckyElements {
            @Schema(description = "幸运颜色")
            private List<String> colors;
            
            @Schema(description = "幸运方位")
            private List<String> directions;
            
            @Schema(description = "幸运数字")
            private List<Integer> numbers;
            
            @Schema(description = "幸运材质")
            private List<String> materials;
            
            @Schema(description = "幸运时间")
            private List<String> times;
        }
    }
    
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "使用情况")
    public static class UsageInfo {
        @Schema(description = "Token消耗", example = "1250")
        private Integer tokens;
        
        @Schema(description = "费用", example = "0.025")
        private Double cost;
    }
}